<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>计算属性-正方形面积</title>
  <script type="text/javascript" src="vue.js"></script>
</head>
<body>
  <script>
    let square = { length:2 };

    let vm = new Vue({
      data: square,
      computed: {
        area(){
          return this.length * this.length;
        }
      }
    })
    console.log(vm.area);  // 4
  </script>
</body>
</html>
